package models

import (
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

type News struct {
	Id    int    `json:"id"`
	Title string `json:"title"`
	Time  string `json:"time"`
	Fl    string `json:"fl"`
}

var DB *gorm.DB

func init() {
	dsn := "root:root@tcp(127.0.0.1)/day12"
	var err error
	DB, err = gorm.Open(mysql.Open(dsn))
	if err != nil {
		panic("数据库连接失败")
	}
}
